﻿using AyCodeLibs.StandardExtensions.Extensions;
using AyFrame.Common.Enums;
using AyFrame.DbJsonModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AyFrame.Dto
{
    public class OcelotGatewayCreateDto
    {
        public string Description { get; set; }

        public GatewaySys GatewaySys { get; set; }

        public string UpstreamPathTemplate { get; set; }

        public List<string> UpstreamHttpMethod { get; set; }

        public List<DownstreamHostAndPortsItems> DownstreamHostAndPorts { get; set; }

        public string DownstreamPathTemplate { get; set; }
    }

    public class OcelotGatewayUpdateDto : OcelotGatewayCreateDto
    {
        public string Id { get; set; }
        public string TimeStamp { get; set; }
    }

    public class OcelotGatewayView : OcelotGatewayUpdateDto
    {
        public string DownstreamScheme { get; set; } = "Http";
        public string Method => UpstreamHttpMethod.Aggregate(string.Empty, (a, b) => a += $"{b},").TrimEnd(',');
        public string GatewayName => GatewaySys.GetDescription();
    }

    public class OcelotSearchRequest : SearchPage
    {
        public GatewaySys? GatewaySys { get; set; }
    }
}
